﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Box : MonoBehaviour {

	[Range(0, 1)] [SerializeField] float m_PullPenalty;
	AudioSource m_Audio;
	Rigidbody2D rb;

	private void Awake() {
		//m_Audio = GetComponent<AudioSource>();
		rb = GetComponent<Rigidbody2D>();

		//m_Audio.Stop();
	}

	public void Update() {
		//PlaySound();
	}

	public float PullPenatly {
		get => m_PullPenalty;
	}

	void PlaySound() {
		Debug.Log(rb.velocity != Vector2.zero);
		Debug.Log(!m_Audio.isPlaying);

		if(rb.velocity != Vector2.zero && !m_Audio.isPlaying) {
			m_Audio.Play();
		} else if(rb.velocity == Vector2.zero && m_Audio.isPlaying) {
			m_Audio.Stop();
		}

	}

}
